package casess;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: fzykd
 * Date: 2022-10-24
 * Time: 14:11
 */

class Singleton {
    private static Singleton instance = new Singleton();
    private Singleton(){}

    //静态的属于类
    public static Singleton getInstance(){
        return instance;
    }
}


//单例模式 - 饿汉模式
public class Demo1 {
    Singleton instance = Singleton.getInstance();
}
